package vocabularyhub.word.mw.thesaurus.impl;

import java.io.Serializable;
import java.util.Arrays;

import vocabularyhub.word.mw.thesaurus.model.IThesaurusItem;

public class ThesaurusItem implements IThesaurusItem, Serializable {

    private static final long serialVersionUID = 4436817641617045068L;

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public String getMeaning() {
        return meaning;
    }

    public void setMeaning(String meaning) {
        this.meaning = meaning;
    }

    public String[] getSentence() {
        return sentence;
    }

    public void setSentence(String[] sentence) {
        this.sentence = sentence;
    }

    public String[] getSyn() {
        return syn;
    }

    public void setSyn(String[] syn) {
        this.syn = syn;
    }

    public String[] getRel() {
        return rel;
    }

    public void setRel(String[] rel) {
        this.rel = rel;
    }

    public String[] getNear() {
        return near;
    }

    public void setNear(String[] near) {
        this.near = near;
    }

    public String[] getAnt() {
        return ant;
    }

    public void setAnt(String[] ant) {
        this.ant = ant;
    }

    @Override
    public String toString() {
        StringBuffer sb = new StringBuffer();
        sb.append("index=").append(this.index).append("\n");
        sb.append("Meaning:").append(meaning).append("\n");
        if (sentence != null) {
            sb.append(sentence.length).append(" Sentences: ").append(
                    Arrays.deepToString(sentence)).append("\n");
        }
        if (syn != null) {
            sb.append(syn.length).append(" Synonyms: ").append(
                    Arrays.deepToString(syn)).append("\n");
        }
        if (rel != null) {
            sb.append(rel.length).append(" Related Words: ").append(
                    Arrays.deepToString(rel)).append("\n");
        }
        if (near != null) {
            sb.append(near.length).append(" Near Antonyms: ").append(
                    Arrays.deepToString(near)).append("\n");
        }
        if (ant != null) {
            sb.append(ant.length).append(" Antonyms: ").append(
                    Arrays.deepToString(ant)).append("\n");
        }

        return sb.toString();
    }

    /** should start from 1, the sequence of items in a word */
    private int index;
    private String meaning;
    private String[] sentence;
    private String[] syn;
    private String[] rel;
    private String[] near;
    private String[] ant;

}
